<template>
  <Add v-if="show" />
</template>

<script setup>
import { nextTick } from "vue"
import Add from "../add/index.vue"
const router = useRouter()
const show = ref(true)
const id = ref("")
// 待优化
watch(
  () => router.currentRoute.value.query,
  (val, oldVal) => {
    if (val.id) {
      setTimeout(() => {
        id.value = val.id
      }, 500)
    }
  }
)
onActivated(() => {
  nextTick(() => {}).then(() => {
    if (id.value != router.currentRoute.value.query.id) {
      show.value = false
      nextTick(() => {
        show.value = true
      })
    }
  })
})
</script>
